﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.Windows.Data;

#if !SILVERLIGHT
namespace UIT.WPF.Renderers
#else
namespace UIT.Silverlight.Renderers
#endif
{
#if !SILVERLIGHT
    class ButtonRenderer : 
        WpfRenderer<Controls.Button, Button>
#else
    public class ButtonRenderer :
        SlRenderer<Controls.Button, Button>
#endif
    {
        public override void Render(Controls.Button control)
        {
            Result = new Button();
            Result.DataContext = control;
            Result.SetBinding(Button.ContentProperty, new Binding("Text"));
            Result.Click += new System.Windows.RoutedEventHandler(Result_Click);
        }

        void Result_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            ((Controls.Button)((System.Windows.FrameworkElement)sender).DataContext).RaiseClick();
        }
    }
}
